<template>
	<view class="QA">
		<view class="main-title">
			{{info.title}}
		</view>
		<view class="title">
			有问必答
		</view>
		<view class="list">
			<view class="col">
				<view class="item" v-for="answer,index in info.answersVoList" :key="answer.id">
					<view class="info ">
						<image :src="answer.userinfo.avatarUrl" mode=""></image>
						<text class="ovh">{{answer.userinfo.nickname}}</text>
					</view>
					<view class="text">
						{{answer.result}}
					</view>
				</view>
			</view>
		</view>
		<view class="submit">
			<navigator :url="`./putQuestion?questions_id=`+info.id">提交问答</navigator>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				questions_id:'',
				info:[],
			}
		},
		onLoad(option) {
			this.questions_id = option.questions_id
		},
		onShow() {
			this.getDetail(this.questions_id)
		},
		methods: {
			getDetail(questions_id) {
				this.$post("/course/questions_detail", {
					questions_id
				}).then(res => {
					this.info = res.data
				})
			}
		}
	}
</script>

<style lang="scss">
	.main-title {
		font-size: 56rpx;
		font-weight: bold;
		padding: 30rpx;
	}

	.title {
		font-size: 36rpx;
		padding: 30rpx;
		font-weight: bold;
	}

	.col {
		padding: 10rpx 0;

		.item {
			box-shadow: 0px 0 12rpx rgba(0, 0, 0, 0.1);
			border-radius: 18rpx;
			padding: 30rpx;
			display: flex;
			align-items: center;

			.info {
				display: flex;
				align-items: center;
				font-size: 24rpx;
				color: #999;
				width: 150rpx;

				image {
					border-radius: 50%;
					width: 60rpx;
					height: 60rpx;
					margin-right: 10rpx;
				}

				text {
					width: calc(100% - 70rpx);
				}
			}

			.text {
				width: calc(100% - 150rpx);
				font-size: 28rpx;
				font-weight: bold;
			}
		}
	}

	.submit {
		background: linear-gradient(180deg, rgba(155, 227, 224, 1) 0%, rgba(81, 199, 108, 1) 100%);
		color: #fff;
		width: 400rpx;
		text-align: center;
		line-height: 80rpx;
		font-size: 40rpx;
		box-shadow: 0px 3px 6px 0px rgba(81, 199, 108, 0.4);
		border: 1px solid rgba(81, 199, 108, 1);
		border-radius: 100px;
		margin: 50rpx auto;
	}
</style>